home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / tvcolor.exe / COLORDLG.DOC < prev    next >
Text File  |  1992-06-27  |  16KB  |  376 lines

  1.  
  2.      TVColorDialog Version 1.01
  3.      (C) Copyright 1992 Michael Newton and Comsoft Software.
  4.      All rights reserved.
  5.  
  6.      The TVColorDialog C++ library was created with Borland C++ verion 3.1 and
  7.      Borland's Turbo Vision version 1.0.
  8.  
  9.      Borland's Turbo Vision version 1.0 is required to use the TVColorDialog
  10.      library.
  11.  
  12.      Michael Newton
  13.      Comsoft Software
  14.      17874 Marygold Ave. Suite 32
  15.      Bloomington  CA  92316  USA
  16.  
  17.      Voice           (714) 877-4655
  18.      CompuServe      70402,531   (as Michael J. Newton)
  19.      RelayNet/RIME   ->ECTECH    (as Mick Newton)
  20.      Internet        70402.531@compuserve.com
  21.  
  22. *********************************  NOTICE  *************************************
  23. IMPORTANT! Please read this entire file before attempting to use COLORDLG.LIB.
  24. ********************************************************************************
  25.  
  26. --------------------------------------------------------------------------------
  27. Files included in this archive
  28. ------------------------------
  29.  
  30. Filename      Size   Date      Time   Description
  31. -------------------------------------------------
  32. COLORDLG.LIB  19968  06-27-92  1:01a  TVColorDialog large model C++ library file
  33. COLORDLG.HPP  7603   06-27-92  1:01a  Header file for COLORDLG.LIB
  34. COLORDLG.DOC  13857  06-27-92  1:01a  This file
  35. TDEMO.CPP     20712  06-27-92  1:01a  C++ source for TVColorDialog demo program
  36. TDEMO.HPP     2809   06-27-92  1:01a  Header file for TVColorDialog demo program
  37. ORDER.DOC     1585   06-27-92  1:01a  Order form
  38.  
  39. --------------------------------------------------------------------------------
  40. What is it?
  41. -----------
  42.  
  43.    TVColorDialog is a Turbo Vision dialog box that gives users of your Turbo
  44. Vision application the ability to change the colors and background pattern
  45. inside your application.
  46.    TVColorDialog consists of the TVColorDialog class and support files, in C++
  47. large memory model library form.
  48.    Fully commented C++ source code for TVColorDialog is also available for a
  49. nominal fee.
  50.  
  51.                                     Page 1
  52.  
  53.                            TVColorDialog Version 1.01
  54. --------------------------------------------------------------------------------
  55. How do I use it?
  56. ----------------
  57.  
  58.    TVColorDialog class summary (COLORDLG.HPP)
  59.  
  60.    TDialog ----> TVColorDialog
  61.  
  62. The TVColorDialog class provides viewers from which the user can select and
  63. change the color assignments and background pattern from available palettes with
  64. immediate effect on the screen. It is a specialized scrollable dialog box called
  65. "Colors and desktop pattern" from which the user can examine various palette
  66. selections and pattern characters before making a selection.
  67.  
  68.  Constructor:
  69.   TVColorDialog(TPalette *aPalette, TColorGroup *aGroups,
  70.                 TSItem *aStrings, Boolean addHelpButton = False);
  71.  
  72.   TVColorDialog(StreamableInit);
  73.  
  74.  Data Members:
  75.   TColorDialog::bakLabel         TColorDialog::bakSel
  76.   TColorDialog::display          TColorDialog::forLabel
  77.   TColorDialog::forSel           TColorDialog::groups
  78.   TColorDialog::monoLabel        TColorDialog::monoSel
  79.   TColorDialog::pal              TColorDialog::patSel
  80.   TColorDialog::aHelpButton
  81.  
  82.  Member Functions:
  83.   TColorDialog::build            TColorDialog::dataSize
  84.   TColorDialog::getData          TColorDialog::handleEvent
  85.   TColorDialog::read             TColorDialog::setData
  86.   TVColorDialog::TVColorDialog   TColorDialog::write
  87.  
  88.    TVColorDialog is used almost exactly as you would use Turbo Vision's
  89. TColorDialog class. The only difference is that you must also pass it a pointer
  90. to a TSItem object. The TSItem object is actually a linked list of TSItems, each
  91. of which is actually a pointer to a string. The first character in each string
  92. will be used by TVColorDialog as a pattern character selection in the dialog
  93. box.
  94.    The pattern characters are used to create a TPatternCluster of
  95. TPatternButtons which the user can use to select a pattern character for the
  96. background.
  97.    The TVColorDialog constructor also accepts an optional Boolean parameter
  98. which, if set, will cause TVColorDialog to include a "help" button in the dialog
  99. box. If you use this option, you should set the helpCtx member of the dialog box
  100. before execView'ing it or insert'ing it.
  101.    Please read the source code in TDEMO.CPP to get a better idea of how
  102. TVColorDialog is used.
  103.  
  104.                                     Page 2
  105.  
  106.                            TVColorDialog Version 1.01
  107. --------------------------------------------------------------------------------
  108.  
  109. *************************** IMPORTANT NOTICE!  *********************************
  110. *                                                                              *
  111. *   Please read and follow these instructions before attempting to use         *
  112. *   TVColorDialog in your applications.                                        *
  113. *                                                                              *
  114. ********************************************************************************
  115.  
  116.    To use TVColorDialog, some minor modifications will be needed in the Turbo
  117. Vision source code. TVColorDialog will not compile without these changes. If you
  118. don't have access to the Turbo Vision source code, or don't want to edit the
  119. source and re-compile, then TVColorDialog isn't for you. The changes necessary
  120. are rather minor though, and I have never experienced any problems with the
  121. changes after rebuilding the library. So if your still interested, read on.
  122.  
  123.    The only file that needs to be changed is APP.H in the Turbo Vision include
  124. directory. Follow these simple instructions...
  125.  
  126. (1) Change to the Turbo Vision include directory. This is usually named
  127.     C:\BORLANDC\TVISION\INCLUDE
  128.  
  129. (2) Start BC, or your favorite text editor, and load the file APP.H
  130.  
  131. (3) Move down to line 25. It's a blank line in the TBackground class
  132.     declaration. Just below the line that reads...
  133.  
  134.     virtual TPalette& getPalette() const;
  135.  
  136. (4) Add the following two inline functions...
  137.  
  138.     inline char setPattern(char newPattern)
  139.                    {
  140.                    char oldPattern = pattern;
  141.                    pattern = newPattern;
  142.                    return oldPattern;
  143.                    };
  144.  
  145.     inline char getPattern(void)
  146.                    {
  147.                    return pattern;
  148.                    };
  149.  
  150.    These to functions will give your applications "public" access to the
  151. "private" member variable "pattern". The pattern character is the character used
  152. for the background pattern in Turbo Vision applications.
  153.  
  154.                                     Page 3
  155.  
  156.                            TVColorDialog Version 1.01
  157. --------------------------------------------------------------------------------
  158. IMPORTANT NOTICE! (cont.)
  159. -----------------
  160.  
  161. (5) Now, move down to line 95, into the declaration for TDeskTop. This line
  162.     reads "private:", and causes the following member variable "TBackground
  163.     *background;" to be a "private" member of TDeskTop. Delete line 95. This
  164.     makes "background" a public member of TDeskTop and gives your program access
  165.     to TApplication's background.
  166.  
  167. (6) Save the file as APP.H
  168.  
  169. (7) Rebuild TV.LIB...
  170.  
  171.     (A) Change to the Turbo Vision source directory. This is usually named
  172.         C:\BORLANDC\TVISION\SOURCE
  173.     (B) Open the make file named "MAKEFILE."
  174.     (C) Move to line 12, it reads "BCROOT = ..\..", and make sure this path is
  175.         the correct path to your BORLANDC directory. I had to change mine to
  176.         read "BCROOT = E:\BC". Save the file.
  177.     (B) Type "make" and press <ENTER>.
  178.  
  179.    That's all the modifications necessary. After TV.LIB has been rebuilt, you
  180. can change the desktop's background pattern character by using the setPattern
  181. function which you added in step 4 above, and get the current pattern character
  182. with the getPattern function...
  183.  
  184. Example:
  185.       // Set desktop pattern character to ascii 197 ┼
  186.       deskTop->background->setPattern(197);
  187.  
  188.       // Get the current pattern character into a variable
  189.       char currentPattern